home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK2.toast / Development Kits (Disc 2) / QuickDraw GX / Programming Stuff / Sample Code / Printing Samples / Applications… / Banana Jr. ƒ / panels.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-20  |  1.6 KB  |  78 lines  |  [TEXT/KAHL]

  1. /*
  2.     panels.c 
  3.     
  4.     This file contains the routines for handling panels.
  5.  
  6.     Created        9/2/92        - Dave Hersey
  7.  
  8.     ----------------------------------------------
  9.  
  10.     2/1/93    debugged and plopped on GX CD.  - dmh
  11.     9/93    updated to run with the ß2 "GXified" interface files - PLA
  12.     3/94    updated for B4 - dmh
  13.     8/94    universalized - dmh
  14. */
  15.  
  16. #include <stdio.h>
  17. #include <FontLibrary.h>
  18. #include <GraphicsLibraries.h>
  19. #include <GXEnvironment.h>
  20. #include <GXErrors.h>
  21. #include <QDLibrary.h>
  22. #include <GXPrinting.h>
  23. #include <Collections.h>
  24.  
  25. #include "Banana Jr.h"
  26.  
  27.  
  28. OSErr PageFormatDialog(gxFormat aFormat, StringPtr title, gxDialogResult *result)
  29. {
  30.     OSErr    err;
  31.     
  32.     err = SetUpByPagePanel(aFormat, gAppResRefNum);
  33.     
  34.     if (!err)
  35.         err = Forward_GXFormatDialog(aFormat, title, result);
  36.         
  37.     return err;
  38. }
  39.  
  40.  
  41. OSErr SetUpByPagePanel(gxFormat aFormat, short ourResFile)
  42. {
  43.     OSErr                        err;
  44.     Collection                    fmtCollection;
  45.     gxPanelSetupRecord            panelInfo;
  46.     T_BananaCollection            bananaConfig;
  47.     
  48.     fmtCollection = GXGetFormatCollection(aFormat);
  49.  
  50.     err = GetCollectionItem(fmtCollection, kBananaCollectionType,
  51.                               gxPrintingTagID, nil, &bananaConfig);
  52.     
  53.     if (err == collectionItemNotFoundErr)
  54.     {
  55.         bananaConfig.one        = 0;
  56.         bananaConfig.two        = false;
  57.         bananaConfig.three        = false;
  58.         bananaConfig.four        = false;
  59.         
  60.         err = AddCollectionItem(fmtCollection, kBananaCollectionType,
  61.                                 gxPrintingTagID, sizeof(T_BananaCollection),
  62.                                 &bananaConfig);
  63.     }
  64.     
  65.     if (!err)
  66.     {
  67.         panelInfo.panelKind            = gxApplicationPanel;
  68.         panelInfo.panelResId        = kFormatPanelResID;
  69.         panelInfo.resourceRefNum    = ourResFile;
  70.         panelInfo.refCon            = 0;
  71.         
  72.         err = GXSetupDialogPanel(&panelInfo);
  73.     }
  74.  
  75.     return err;
  76. }
  77.  
  78.